package com.hsh.servlet.user;/**
 * @author xrkhy
 * @date 2025/6/28 23:36
 * @description
 */

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson2.TypeReference;
import com.hsh.pojo.Page;
import com.hsh.pojo.User;
import jakarta.servlet.*;
import jakarta.servlet.http.*;
import jakarta.servlet.annotation.*;

import java.io.IOException;

@WebServlet(name = "UserPageCondition", value = "/UserPageCondition")
public class UserPageCondition extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        String json = request.getReader().readLine();
//        Page<User> page = JSONObject.parseObject(json, Page.class);
        Page<User> page = JSON.parseObject(json, new TypeReference<Page<User>>() {});
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doGet(request, response);
    }
}
